/**
 * 控制台模板
 */
import tem from './index.html'
import $_fn from '~plugins'
class contrlCtrl {
  constructor(rootfun,$scope) {
      $scope.F = rootfun
      var userHelp = $_fn.getLocal('userHelp')
      $_fn.ajaxPost('manager/getRoleInfo.do',{},function(data){
          if(data.type > 0){
              $scope.$apply(function(){
                  $scope.partMen = data.content
              })
          }
      })
      if(userHelp){
          $scope.rightid = userHelp.admin.roleid
      }
      $scope.stati = function(){ 						//方法调用在页面helloContrlTem.html 415行
          $_fn.ajaxPost('manager/consoleStatistic.do','', function (data) {
              $scope.$apply(function () {
                  $scope.indexcontrl = data.content
              })
              var num = data.content.length,width = ''
              if(num==1) width = '100%'
              else if(num==2) width = '48%'
              else if(num==3) width = '32%'
              else if(num==4) width = '23%'
              else width = '23%'
              $('.contrl-span span').css('width',width)
          })
      }
  }
}


contrlCtrl.$inject = ['rootfun','$scope','$rootScope','$timeout','$location','$interval']
module.exports = angular.module('directive.contrl', []).directive('contrl', function() {
    return {
        restrict: 'E',
        template: tem,
        replace:true,
        controller: contrlCtrl
    }
}).name